package com.luck.redis;


import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * 代理类
 * Created by Hua wb on 2018/11/16.
 */
public class RedisProxy implements InvocationHandler{

    private RedisApi redisApi;

    public RedisProxy(RedisApi redisApi) {
        this.redisApi = redisApi;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if (! RedisConfig.IS_CONNECTION) {
            return null;
        }
        return method.invoke(redisApi, args);
    }
}
